package com.elitedatai.mchtest.manage.repository;

import com.elitedatai.mchtest.manage.model.entity.LogsFileEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import java.util.List;
import org.springframework.data.jpa.repository.Query;
import java.util.Optional;

public interface LogsFileRepository extends JpaRepository<LogsFileEntity, Long> {
    List<LogsFileEntity> findByLogsId(String logsId);

    void deleteByLogsId(String logsId);

    /**
     * Find logs file entity by logs id and file id.
     * @param logsId
     * @param fileId
     * @return
     */
    @Query("select l from LogsFileEntity l where l.logsId = :logsId and l.fileId = :fileId")
    Optional<LogsFileEntity> findByLogsIdAndFileId(String logsId, String fileId);
}
